    package com.javafactroy.kunlong.codefactroy;

    import com.javafactroy.kunlong.DbAgent;
    import com.javafactroy.kunlong.base.metadata.model.TMetadataModel;
    import com.javafactroy.kunlong.base.metadata.valueobj.MetadataTable;
    import com.javafactroy.kunlong.base.service.MyService;
    import com.javafactroy.kunlong.framework.batch.JobRunner;
    import com.javafactroy.kunlong.codefactroy.service.tool.DbCodePostgresTool;
    import com.javafactroy.kunlong.codefactroy.service.base.FileTemplateFactroy;
    import com.javafactroy.kunlong.codefactroy.service.filetemplate.db.MapperFileTemplate;
    import com.javafactroy.kunlong.codefactroy.service.stringtemplate.StringTemplate;
    import com.javafactroy.kunlong.codefactroy.service.domain.valueobj.EntityProps;
    import com.javafactroy.kunlong.data.dao.mysql.GeneralMysqlSqlMapper;
    import com.javafactroy.kunlong.data.dao.mysql.MysqlColumnsMapper;
    import com.javafactroy.kunlong.data.dao.mysql.MysqlTablesMapper;
    import com.javafactroy.kunlong.data.dao.mysql.TestMapper;
    import com.javafactroy.kunlong.data.dao.oracle.OracleSqlMapper;
    import com.javafactroy.kunlong.common.utils.CommonUtils;
    import lombok.extern.slf4j.Slf4j;
    import org.junit.jupiter.api.MethodOrderer;
    import org.junit.jupiter.api.Test;
    import org.junit.jupiter.api.TestInstance;
    import org.junit.jupiter.api.TestMethodOrder;
    import org.junit.jupiter.api.extension.ExtendWith;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.boot.test.context.SpringBootTest;
    import org.springframework.context.ApplicationContext;
    import org.springframework.test.context.junit.jupiter.SpringExtension;

    import java.util.List;

    @SpringBootTest(classes = {DbAgent.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
    @ExtendWith(SpringExtension.class)
    @Slf4j
    @TestInstance(TestInstance.Lifecycle.PER_CLASS)
    @TestMethodOrder(MethodOrderer.MethodName.class)

    public class TestCodeFactroyPostgres {
        @Autowired
        MysqlColumnsMapper mysqlColumnsMapper;
        @Autowired
        OracleSqlMapper generalOracleSqlMapper;
        @Autowired
        MysqlTablesMapper mysqlTablesMapper;

        @Autowired
        TestMapper testMapper;

        @Autowired
        TMetadataModel metadataModel;

        @Autowired
        GeneralMysqlSqlMapper generalMysqlSqlMapper;

        @Autowired
        List<ApplicationContext> list;


        @Autowired
        FileTemplateFactroy fileTemplateFactroy;

        @Autowired
        JobRunner jobRunner;

        @Autowired
        MyService myService;

        //TMetadataModel
        @Autowired
        StringTemplate stringTemplate;

        @Autowired
        MapperFileTemplate fileTemplate;


        @Autowired
        DbCodePostgresTool dbCodePostgresTool;

        @Test
        public void test001_makes() {
            dbCodePostgresTool.makes();
        }

        @Test
        public void test002_make() {
            dbCodePostgresTool.make("cms_contents");
        }

        //TentityProps
        @Test
        public void test006_makeProps() {

            MetadataTable tmetadataTable = metadataModel.loadDbMysqlMetadata("tasklog");

            EntityProps entityProps = tmetadataTable.toEntityProps();
            entityProps.makeParams();
            log.info("template params={}", CommonUtils.toJSONString(entityProps.getStringTemplate().getParams()));

            fileTemplateFactroy.rmDbFile(tmetadataTable);

            fileTemplateFactroy.getList().forEach(i -> {

                String stext = i.valueOf(entityProps).parse(i.readFile());
                i.writeFile(stext);
            });
        }


        @Test
        public void test007_table() {
            List list = generalOracleSqlMapper.generalSelect("select 1 from dual");
            log.info("{}", list);

        }


    }
